import java.util.Scanner;

/**
 * Created by zhangyunqi on 2017/9/10.
 */

public class TTest {
    public static void main(String args[])
        {
            int sum=0;
            int i;
            int result=0;
            System.out.println("请输入n值:");
            Scanner scanner = new Scanner(System.in);
            int n = scanner.nextInt();
            result = n*(n+1)/2;
            for(i=1;i<=n;i++)
            {
                sum=sum+i;
            }
            System.out.println("累加结果1为:"+sum);
            System.out.println("累加结果2为:"+result);

        }
    }

